<?php
echo '<table class="contentcate"><tr>';
	echo '<td colspan = "2">';
		echo '<font color ="green"><h3>'.$cat_name.'</h3></font>';
	echo '</td></tr>';
	echo '<tr><td class="contentcate_td1">';
		echo '<img src="'.base_url().'public/images/'.$images.'" width="450" height="340">';;
	echo '</td><td class="contentcate_td2"><table width="100%" height="300">';
		echo '<tr><th class="detailproduct">';
			echo 'PRODUCT DETAIL';
		echo '</td></tr>';
		echo '<tr><td class="contentcate_td3">';
			echo 'DESCRIPTION:'.$cat_description.'<br>'; 
		echo '</td></tr>';
		echo '<tr><td class="contentcate_td3">';
			echo 'DEMENSION:'.$cat_demension.'<br>'; 
		echo '</td></tr>';
		echo '<tr><td class="contentcate_td3">';
			echo 'ASSEMBLY:'.$cat_assembly.'<br>';
		echo '</td></tr>';
		echo '<tr><td class="contentcate_td3">';
			echo 'MATERIAL:'.$cat_material.'<br>';
		echo '</td></tr>';
		echo '<tr><td class="contentcate_td3">';
			echo 'COLOR:'.$cat_color.'<br>';
		echo '</td></tr>';
		echo '<tr><td class="contentcate_td3">';
			echo 'PRICE:'.$cat_price.'<br>';
		echo '</td></tr>';
	echo '</table></td>';
echo '</tr></table>';

echo '<font color ="green"><h3>RELATED PRODUCTS</h3></font>';
$col = 3;
	$countsubcate = count($relation);
	if ($countsubcate>0){//if $countsubcate
		echo '<table class="contentcate">';
			for ($i=0;$i<$countsubcate;$i=$i+$col){//for $countsubcate
				echo '<tr>';
					if(isset($relation[$i]['cat_name'])){
						echo '<td class="contentcate_td"><div class="cellcatlist">';
							echo '<br>'.anchor(base_url().'catcont/getCatSubId/'.$relation[$i]['cat_id'],$relation[$i]['cat_name']).'<br><br>';
							echo anchor(base_url().'catcont/getCatSubId/'.$relation[$i]['cat_id'],'<img src="'.base_url().'public/images/'.$relation[$i]['images'].'" class="statusicon" width="260" height="200">');
							echo '<div class="pricecell">
							Price : '.$relation[$i]["cat_price"].'<br>
							Size : '.$relation[$i]["cat_size"].'
							</div>';
						echo '</div></td>';
					}
					if(isset($relation[$i+1]['cat_name'])){
						echo '<td class="contentcate_td"><div class="cellcatlist">';
							echo '<br>'.anchor(base_url().'catcont/getCatSubId/'.$relation[$i+1]['cat_id'],$relation[$i+1]['cat_name']).'<br><br>';
							echo anchor(base_url().'catcont/getCatSubId/'.$relation[$i+1]['cat_id'],'<img src="'.base_url().'public/images/'.$relation[$i+1]['images'].'" class="statusicon" width="260" height="200">');
							echo '<div class="pricecell">
							Price : '.$relation[$i+1]["cat_price"].'<br>
							Size : '.$relation[$i+1]["cat_size"].'
							</div>';
						echo '</div></td>';
					}
					if(isset($relation[$i+2]['cat_name'])){
						echo '<td class="contentcate_td"><div class="cellcatlist">';
							echo '<br>'.anchor(base_url().'catcont/getCatSubId/'.$relation[$i+2]['cat_id'],$relation[$i+2]['cat_name']).'<br><br>';
							echo anchor(base_url().'catcont/getCatSubId/'.$relation[$i+2]['cat_id'],'<img src="'.base_url().'public/images/'.$relation[$i+2]['images'].'" class="statusicon" width="260" height="200">');
							echo '<div class="pricecell">
							Price : '.$relation[$i+2]["cat_price"].'<br>
							Size : '.$relation[$i+2]["cat_size"].'
							</div>';
						echo '</div></td>';
					}
				echo '</tr>';
			}//end //for $countsubcate
		echo '</table>';
	} //end $countsubcate